﻿@model CooWork.Models.TaskFilterViewModel
@using CooWork.Models;
@{
    using (Html.BeginForm("Index", "Task", FormMethod.Get, new { id = "TaskSearch" }))
    {
     
         
<!--jstree-->
 <link href="@Url.Content("~/Content/themes/style.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.jstree.js")" type="text/javascript"></script>
<!--jstree-->    
<div id="demo1" class="demo"></div>
<script type="text/javascript" >
    $(function () {
        $("#Owner_UI").click(function () {
            if ($("#demo1").is(':visible')) {
                $("#demo1").hide();
            }
            else {
                $("#demo1").show();
            }
            $("#Owner_UI").parent("div").append($("#demo1"));
            $("#Owner").val("");
            $("#departmentId").val("");
        });

        $("#demo1").hide();
        $("#demo1").jstree({
            "json_data": {
                "ajax": {
                    "url": "/data/totalOrg",
                    "data": function (n) {
                    }
                }
            },
            "plugins": ["themes", "json_data", "ui"]
		, "core": { "initially_open": "department_1", "animation": 0 }
        }).bind("select_node.jstree", function (e, data) {
            $("#Owner_UI").val($.trim(data.rslt.obj.find("a").eq(0).text().toString()));
            if (data.rslt.obj.attr("id").toString().indexOf("department") >= 0) {
                $("#departmentId").val($.trim(data.rslt.obj.attr("id").toString()));
                $("#Owner").val("");
            }
            else {
                $("#departmentId").val("");
                $("#Owner").val($.trim(data.rslt.obj.attr("id").toString()));
            }
            $("#demo1").hide();
        });
    });
</script>
        
    
         <div id="searchFilter"><div>     
         <table>
         <tr><td colspan="8">
         <script type="text/javascript">
             $(document).ready(function () {
                 var taskTypei = GetQueryString("taskType");
                 if (taskTypei == null) taskTypei = 1;
          
                 $("#taskType").val(taskTypei);                          
                 $(".btn_01 a").eq(taskTypei - 1).css("font-weight", "bold").css("color", "#E1EFF9").css("border", "1px dashed #ffffff");

             });
         </script>
         <div style="padding-top:15px;padding-bottom:15px;" class="btn_01">快捷链接：         
       <a href="/task/?taskType=1">所有任务</a>        <a href="/task/?taskType=2">我负责的任务</a>   <a href="/task/?taskType=3">我创建的任务</a> <a  href="/task/?taskType=4">本部门负责的任务</a> <a  href="/task/?taskType=5">本部门创建的任务</a>   <a href="/task/?taskType=6">我跟踪的任务</a> 
            <input type="hidden" id="taskType" name="taskType" value="1" />
          </div>

         </td></tr>

         <tr>
         
         <td>Status:                   </td>
         <td>
            @Html.Action("ddlstatus", "Home", new { id = Model.StatusId, name = "StatusId" })
         </td>
          <td>Priority:</td><td>
            @Html.Action("ddlpriority", "Home", new { id = Model.priority, name = "priority" })
         </td><td>Severity:                   </td><td>
            @Html.Action("ddlseverity", "Home", new { id = Model.severity, name = "severity" })
         </td>
         <td> Owner: </td>
         
         <td > 
         <div style="position:absolute;width:150px;float:right;" >
         @{
                var Owner_UI_value = string.Empty;
                if (!String.IsNullOrWhiteSpace(Request.QueryString["Owner"]))
                {
                    Owner_UI_value = CacheSet.DorU2N(Request.QueryString["Owner"]);
                }
                else if (!String.IsNullOrWhiteSpace(Request.QueryString["departmentId"]))
                {
                    Owner_UI_value = CacheSet.DorU2N(Request.QueryString["departmentId"]);
                }             
            }
         <input type="text"  id="Owner_UI" value="@(Owner_UI_value)"   />
         <input type="hidden" id="Owner" name="Owner" value="@(Request.QueryString["Owner"])" />   
         <input type="hidden" id="departmentId" name="departmentId" value="@(Request.QueryString["departmentId"])"  />
         </div>
         </td>


         </tr>
         </table>
         <table>
         <tr><td colspan="3">Description</td>
         <td>CreateTime</td>
         <td>Estimate</td>
         <td>remaining</td>
         <td> 标签 </td>
         <td></td>
         </tr>
         <tr><td colspan="3"> @Html.TextBox("taskDescription", Model.taskDescription, new { size = 30, maxlength = "40" }) </td>
        
         <td> @Html.TextBox("cdate1", Model.cdate1, new { style = "width:100px", maxlength = "40" })  @Html.TextBox("cdate2", Model.cdate2, new { style = "width:100px", maxlength = "40" })</td>
         <td> @Html.TextBox("estimate1", Model.estimate1, new { style = "width:30px", maxlength = "40" })  -  @Html.TextBox("estimate2", Model.estimate2, new { style = "width:30px", maxlength = "40" })</td>
         <td> @Html.TextBox("remaining1", Model.remaining1, new { style = "width:30px", maxlength = "40" })  -  @Html.TextBox("remaining2", Model.remaining2, new { style = "width:30px", maxlength = "40" })</td>
         <td> @Html.TextBox("tag", Model.tag, new { style = "width:30px", maxlength = "40" })</td>
         <td><input type="submit" value="Search" class="btnNeutral" /> <input type="button" id="searchClear" value="Clear" class="btnNeutral" /></td>
         </tr></table>   
          
          <span>       
    </span>
         </div>
         
         </div>
         
    }
}
